perm filename TIDY.DOC[PAS,SYS] blob
sn#465719 filedate 1979-08-13 generic text, type T, neo UTF8
/------/
/------/
H E W L E T T /- hp -/ P A C K A R D
/======/
/======/
HP LABS - 3500 Deer Creek Road, Palo Alto, California 94304
-----------------------------------------------------------------
FROM: Bruce Nordman DATE: 79-03-26
TO: PASCAL Users SUBJECT: PASCAL Pretty-printer
A Major trouble with most pretty-printers is that they have
and only one output format. As everyone has a different format
they prefer to see their programs appear in, options are needed
so that the prettyprinter can be adapted to an individual's
taste(or lack thereof). Based on a pretty-printer from UBC, I
have written such a program. There are relatively few options at
this point(29), but as new ones are suggested, the list grows.
Tidy will first ask for options; this can be terminated by
a ↑Z. It will then ask for the result file, then for the source
file.
The pretty-printer will never split tokens (except for
some comments) and thus should always produce a program that is
still compilable. In a given statement, multiple blanks are
reduced to a single blank, but single blanks are rarely elimi-
nated. Attention is paid to the original format of the program
when placing comments and statements.
As not all comments are created equal, the pretty-printer
classifies each comment as one of 14 different types. To decide
this, it uses the position it was in originally, what came before
it, what comes after it, how long it is, and other information.
An option is set by giving it's name, and the value it is to
be set to, i.e. Density := 8; . Notice that the := and the ;
are ignored. The pretty-printer ignores characters it doesn't
expect so that people can format their options in a readable
fashion. Also, the option names can be abbreviated up to the
amount shown in Upper case below, however case is ignored by the
program. To set the Density option to 8, dEn 8 and Density := 8;
are equivalent. A numeric option (n) is limited to the range
0..99; a shift option (s) is limited to 'A' for as is, 'L' for
downshifting, 'M' for a leading uppercase followed by lowercase,
and 'U' for upshifting; and boolean options(b) are limited to
true and false, specified by '+' and '-' respectively. The
current options are:
Width n - The size of each input line, not including any line for
numbers present. Default: 160.
INdentation n - The number of spaces of indentation after a
CONST, TYPE, VAR, procedure of function header, FOR,
WITH, WHILE, IF, ELSE, or REPEAT. RECORD and CASE
indentations are separate options. Default 3.
COntinuation←indent n - The number of extra spaces of indentation
for continued lines. Default: 6.
JOin←density n - A number in 0..99 which determines how much can
be put on a given line when the statements were
originally on separate lines. The higher the number,
the more dense the output. Default 20.
DENsity n - A number in 0..99 which determines how much can be
put on a given line when the statements were originally
on the same line. The higher the number, the more
dense the output. Default: 70.
Comment Options:
Tab←comment n - The column at which many comments are put.
Default: 35.
USe←tab b - Put many comments at Tab←comment. Default: +.
FIt←comment b - Try to put comments on the same line as text even
if the text extends beyond Tab←comment. Default: +.
B←Comment b - Put comments after BEGIN's immediately after the
BEGINs rather than at Tab←comment. Default: -.
E←Comment b - Put comments after ENDs immediately after the ENDs
rather than at Tab←comment. Default: +.
JUstify←comment n - The rightmost column that will result in a
comment at Starting←column. Default: 2.
Absolute←comment n - The deviation from the output indent level
of the position of a comment for the comment to be put
at the current indent level. Default: 10.
Block Structure Options:
LEading←do b - DO and THEN printed at the left of the following
statement. Default: -.
B←Append b - BEGIN's are likely to be put on the same line as
the phrase preceding them. Default: -.
E←Append b - ENDs are likely to be put on the same line as the
phrase preceding them. Default: -.
BEgin←indent n - The amount of indentation for statements inside
BEGIN-END blocks. Default: 0.
Case←indent n - The amount of indentation for CASE statements.
Default: 3.
FIeld←indent n - The amount of indentation for RECORD fields.
Default: 3.
Other Formatting Options:
LAbel←out n - The maximum number of columns a label is set out
from a statement. Default: 15.
DEClaration←tab n - The minimum number of columns given for names
before an '=' or ':' in declaratins. Default: 12.
Name←limit n - The maximum number of columns for names in labels
and variable lists. Default: 80.
Output Appearance Options:
Out←width n - The maximum size of each output line. Default: 72.
UNderline b - Underline reserved words. Default: -.
BOldfaces n - The number of overprints of reserved words.
SPace←reserved b - Assure a space around many reserved words.
Default: -.
Reserved←shift s - How to shift reserved words. Default: As←is.
ID←shift s - How to shift non-reserved identifiers.
Default: As←is.
STarting←column n - The first column to use. Default: 1.
In addition to these options, the word SHow will display all
of the options and their current values, and the word Help may
be of help.
Please report all bugs found, and all suggestions you have.